package com.his.common.configurer;

import com.his.common.interceptor.LoginHandlerInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class MyWebConfigurerAdapter implements WebMvcConfigurer {
    @Autowired
    private LoginHandlerInterceptor loginHandlerInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        List<String> excludePath = new ArrayList<String>();
        excludePath.add("/login/login.html");
        excludePath.add("/error.html");
        excludePath.add("/api/v1/article/*");
        excludePath.add("/index");
        registry.addInterceptor(loginHandlerInterceptor)
        .excludePathPatterns(excludePath).addPathPatterns("/**");
    }

}
